Skip to content

Conversation

yinzara
Copy link

@yinzara yinzara commented May 29, 2025

Fixes #459

NumberHandling = JsonNumberHandling.AllowReadingFromString)]
NumberHandling = JsonNumberHandling.AllowReadingFromString
#if NET9_0_OR_GREATER
,UseStringEnumConverter = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want different behaviors here based on which build is being used.
cc: @eiriktsarpalis

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this doesn't address the issue at hand. UseStringEnumConverter tells the source generator to use the string-based converter for enums that it can see at compile time. It can't apply the same behavior to types introduced by the user since it can't be done in a AOT compatible manner.

@yinzara
Copy link
Author

yinzara commented May 29, 2025 via email

@eiriktsarpalis
Copy link
Member

Superseded by #463. I'm going to close this, but thank you for the contribution regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

McpJsonUtilities does not function as documented - Enums get serialized to integer, not string

4 participants